FROM debian:12.11-slim
LABEL author=xiaoyilin
LABEL email=406735078@qq.com
ARG H_V
ADD vernemq-$H_V.bookworm.x86_64.tar.gz /usr/local/vernemq-$H_V
RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list.d/debian.sources && \
apt-get -y update && apt-get install -y libssl3 libsnappy1v5 && rm -rf /var/lib/apt/lists/* && \
sed -i '9s/accept_eula = no/accept_eula = yes/g' /usr/local/vernemq-$H_V/etc/vernemq.conf && \
#sed -i 's/accept_eula = no/accept_eula = yes/g' /usr/local/vernemq-$H_V/etc/vernemq.conf && \
sed -i '20s/allow_anonymous = off/allow_anonymous = on/g' /usr/local/vernemq-$H_V/etc/vernemq.conf && \
#sed -i 's/allow_anonymous = off/allow_anonymous = on/g' /usr/local/vernemq-$H_V/etc/vernemq.conf && \
ENV TZ=Asia/Shanghai
ENV PATH=$PATH:/usr/local/vernemq-$H_V/bin
WORKDIR /usr/local/vernemq-$H_V/bin
CMD ["vernemq","console"]

# https://docs.vernemq.com/getting-started
# docker build  --build-arg H_V=2.1.1 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/vernemq:2.1.1 .
# docker run --rm registry.cn-hangzhou.aliyuncs.com/xiaoyilin/vernemq:2.1.1
# docker run --rm -it registry.cn-hangzhou.aliyuncs.com/xiaoyilin/vernemq:2.1.1 bash
# docker run -d -p 1883:1883 -it registry.cn-hangzhou.aliyuncs.com/xiaoyilin/vernemq:2.1.1
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/vernemq:2.1.1
# docker pull registry.cn-hangzhou.aliyuncs.com/xiaoyilin/vernemq:2.1.1